﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///  文件上传类
/// </summary>
public class FileBLL
{
    public string UpNewsImage(byte[] data, string fileName)
    {
        int exIndex = fileName.IndexOf(".");
        string extension = "";
        if (exIndex > -1)
        {
            extension = fileName.Substring(exIndex);
        }
        string prepath = DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + Guid.NewGuid().ToString() + extension;
        string path = "D:/wwwroot/down/images/news/" + prepath;
        string msg = "";
        if (Deliver.AsynchronousClient.StartTranCommand(data, path, out msg))
        {
            return "http://down.emoney.cn/images/news/" + prepath;
        }
        else
        {
            return "";
        }
    }

}